<%@page language="java" pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<%@ include file="../../common.jsp"%>
<html>
<head>
    <link rel="stylesheet" href="${ctx}/statics/layui/css/layui.css">
    <link rel="stylesheet" href="${ctx}/statics/css/style.css">
    <link rel="stylesheet" href="${ctx}/statics/css/font-awesome.min.css">
    <style>
        #box {
            margin: 20px auto;
            width: 500px;
            height: 500px;
            border: 1px solid #ccc;
            border-radius: 5px;
            padding: 30px 50px 0px 0px;
        }
    </style>
</head>
<body>
<h2>ADD</h2>
<div id="box">
    <form class="layui-form" method="post" action="addSave" id="user_add_form">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码框</label>
            <div class="layui-input-inline ">
                <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux" id="passwordSpan">辅助文字</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-block">
                <select name="address" lay-verify="required">
                    <option value=""></option>
                    <option value="0">北京</option>
                    <option value="1">上海</option>
                    <option value="2">广州</option>
                    <option value="3">深圳</option>
                    <option value="4">杭州</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户状态</label>
            <div class="layui-input-block">
                <input type="checkbox" value="1" lay-text="启用|禁用" name="status" lay-skin="switch">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="radio" checked name="gender" value="0" title="男">
                <input type="radio" name="gender" value="1" title="女">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">XX日期</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" id="admissionDate" name="admissionDate">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" id="submit_btn">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<script src="${ctx}/statics/layui/layui.all.js"></script>
<script src="${ctx}/statics/validate/jquery.min.js"></script>
<script src="${ctx}/statics/validate/jquery.validate.min.js"></script>
<script src="${ctx}/statics/validate/messages_zh.min.js"></script>
<script src="${ctx}/statics/validate/jquery.validate.extend.js"></script>
<script>
    // var $ = layui.jquery;
    var laydate = layui.laydate;

    laydate.render({
        elem:'#admissionDate',
        type: 'datetime'
    })

    $("#user_add_form").validate({
        onkeyup: false,
        rules:{
            username:{
                minlength: 2,
                maxlength: 20
            },
            password:{
                minlength: 5,
                maxlength: 20
            },
            address:{
                required:true
            },
            status:{
                required:true
            },
            gender:{
                required:true
            }
        },
        messages: {

        },
        focusCleanup: true
    });

    $("#submit_btn").click(function () {
        if ($("#user_add_form").validate.form()) {
            var data = $("#user_add_form").serializeArray();
            // $.operate.saveTab(prefix + "/add", data);
        }
    })



</script>
</body>
</html>
